package com.eagletsoft.mmproj.service;

import com.eagletsoft.mmproj.WeiboDelegate;
import com.weibo.sdk.android.api.StatusesAPI;

public class TimelineService extends BaseService{
	private StatusesAPI statusesAPI;
	
	public TimelineService(String reqType, IServiceListener listener)
	{
		super(reqType, listener);
		statusesAPI = new StatusesAPI(WeiboDelegate.getInstance().getAccessToken());
	}
	
	void getTimelineNewerThan(long since_id)
	{
		statusesAPI.userTimeline(WeiboDelegate.uid, since_id, 0L, WeiboDelegate.pagesize, this);
	}
	
	void getTimelineOlderThan(long max_id)
	{
		statusesAPI.userTimeline(WeiboDelegate.uid, 0L, max_id, WeiboDelegate.pagesize, this);
	}

	@Override
	protected ServiceResult makeResult(String res) throws Exception{
		Object data = com.eagletsoft.mmproj.model.Status.constructWapperStatus(res);
		
		return new ServiceResult(data);
	}
}
